﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IrisGenerator.Framework.Messaging
{
    public static class Result
    {
        public static MessageResults ConvertFrom(DialogResult dlg)
        {
            switch (dlg)
            {
                case DialogResult.Abort:
                    return MessageResults.Abort;
                    break;
                case DialogResult.Cancel:
                    return MessageResults.Cancel;
                    break;
                case DialogResult.Ignore:
                    return MessageResults.Ignore;
                    break;
                case DialogResult.No:
                    return MessageResults.No;
                    break;
                case DialogResult.None:
                    return MessageResults.None;
                    break;
                case DialogResult.OK:
                    return MessageResults.OK;
                    break;
                case DialogResult.Retry:
                    return MessageResults.Retry;
                    break;
                case DialogResult.Yes:
                    return MessageResults.Yes;
                    break;
                default:
                    return MessageResults.None;
                    break;
            }
        }
        public static MessageResults ConvertFrom(int value)
        {
            switch (value)
            {
                case 0:
                    return MessageResults.Abort;
                    break;
                case 1:
                    return MessageResults.Cancel;
                    break;
                case 2:
                    return MessageResults.Ignore;
                    break;
                case 3:
                    return MessageResults.No;
                    break;
                case 4:
                    return MessageResults.None;
                    break;
                case 5:
                    return MessageResults.OK;
                    break;
                case 6:
                    return MessageResults.Retry;
                    break;
                case 7:
                    return MessageResults.Yes;
                    break;
                default:
                    return MessageResults.None;
                    break;
            }
        }
        public static MessageResults ConvertFrom(string value)
        {
            return (MessageResults)Enum.Parse(typeof(MessageResults), value, true);
            
        }

    }
}
